#!/bin/bash
#echo -n "enter your name: "
#read aa
#echo "hello $aa ,"

#read -p "plese enter your age : " age
#read -p "plese enter your name : " name
#days=$[ $age * 365 ]
#echo "your $days days old"
#echo "$REPLY"

#read -t 2 -p "enter your name : " 
#echo "hello $REPLY"
#read -n 1 -p "y / n ? " answer
#case $answer in 
#	Y | y) echo "ok" ;;
#	N | n) echo "no" ;;
#	*) echo something
#	exit ;;
#esac

#read -s -p "enter your password : " pass
#echo "really $pass"

#count=1
#cat test.sh | while read line
#do
#	echo "line $count: $line"
#	count=$[ $count + 1 ]
#done
#exec 3>test13out
#echo "This should display on the monitor"
#    echo "and this should be stored in the file" >&3
#	    echo "Then this should be back on the monitor"

#exec 3>&1
#exec 1>test14out
#echo "This should display on the monitor"
#    echo "and this should be stored in the file" >&3
#	    echo "Then this should be back on the monitor"
#exec 3<> testfile
#read line <&3
#echo "read : $line"
#echo "this is a test line" >&3
#tempfile=$(mktemp test19.XXXXXX)
#exec 3>$tempfile
#echo "this script writes to temp file $tempfile"
#echo "this is the first line" > &3
#echo "this is the SECONDS line" > &3
#echo "this is the last line" > &3
#exec 3>&-


#$tempfile=$(mktemp -t dss.XXXXXX)
#vi $tempfile
#trap "echo 'sorry i have trapped ctrl-c'" SIGINT
#echo this is a test script
#count=1
#while [ $count -le 10 ]
#do
#	echo "loop #$count"
#	sleep 1
#	count=$[ $count + 1 ]
#done

:<<!
trap "echo bye" exit

count=1
while [ $count -le 10 ]
do
	echo "loop #$count"
	sleep 1
	count=$[ $count + 1 ]
done
	
trap "echo 'sorry ctrl-c'" SIGINT

count=1
while [ $count -le 10 ]
do
	echo "loop #$count"
	sleep 1
	count=$[ $count + 1 ]
done

trap "echo modified" SIGINT
count1=1
while [ $count1 -le 5 ]
do
	echo "SECONDS loop $count1"
	sleep 1
	count1=$[ $count1 + 1 ]
done
echo "script process ID :: $$"
count=1
while [ $count -le 10 ]
do
	echo "loop $count"
	sleep 10
	count=$[ $count + 1 ]
done


function aa {
	echo 'aa'
	bb
}
function bb {
	echo 'bb'
}
count=1
while [ $count -le 5 ]
do
	aa
	count=$[ $count + 1 ]
done
echo "end"
aa


func1 () {
	echo "trying to display a non-existent file "
	ls -l 
}
echo "testing the function :"
func1
echo "the exit status is : $?"



function dbl {
	read -p "enter a value : " value
	return $[ $value * 2 ]
}
!

